package com.lc.rocketmq.controller;

import com.lc.rocketmq.service.SeckillService;
import com.lc.rocketmq.vo.SeckillVo;
import com.lc.rocketmq.vo.WaitingPayVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SecKillController {

    @Autowired
    SeckillService seckillService;

    @PostMapping("/token")
    public String token(@RequestBody SeckillVo vo){
        return seckillService.token(vo);
    }

    @PostMapping("/seckill")
    public String secKill(@RequestBody SeckillVo vo){
        //秒杀
        return seckillService.doSeckill(vo);
    }

    @PostMapping("/pay")
    public String pay(@RequestBody WaitingPayVo vo){
        //支付
        return seckillService.pay(vo);
    }

    @GetMapping("/result")
    public String result(@RequestBody SeckillVo vo){
        //查询结果
        return seckillService.result(vo);
    }
}
